<?php


/**
* Puree CMS
* http://www.molotsoft.ru
*
* @package Puree_CMS
* @subpackage Models
* @author Ivan Chistyakov <ivan@molotsoft.ru>
* @version $Id: contact.php 1254 2010-04-01 12:32:10Z molotsoft@gmail.com $
* @link $HeadURL: http://puree-cms.googlecode.com/svn/trunk/models/contact.php $
*/


class Contact extends GeneralModel {

/******************************************************************************/

var $name = 'Contact';

var $displayImage = 'map';
var $displayField = 'caption';

var $order = array(
	//'Contact.position' => 'ASC',
	'Contact.id' => 'ASC'
);

var $actsAs = array(
	'Admin.Automate',
	'Containable'
);

var $fieldInputSchema = array(
	'contacts' => array('type' => 'wysiwyg'),
	'address' => array('type' => 'wysiwyg'),
	'phones' => array('type' => 'wysiwyg'),
	'emails' => array('type' => 'wysiwyg'),
	'map' => array('type' => 'image', 'tab' => 'map', 'params' => 'resize=crop&x=500&y=400')
);

var $tabSchema = array(
	'map' => array('icon' => 'map'),
	'feedback' => array('icon' => 'email')
);

/******************************************************************************/

function _describeFieldInput($field_name, $field_description = array()) {
	// change tab
	if ((bool)preg_match('~^(map|feedback)(_[a-z0-9_]+)?$~', $field_name, $match)) {
		$field_description['input']['tab'] = $match[1];
	}
	return $field_description['input'];
}

/******************************************************************************/

/*function beforeDelete($cascade) {
	return FALSE;
}*/

/******************************************************************************/

}


?>